@init_organs = [
{
name: "党委办公室",
parent: "塔里木石油开发指挥部第二勘探公司",
category: "机关部门",
rank: "科级"
},
{
name: "信息档案站",
parent: "党委办公室",
category: "机关附属单位",
rank: "股级"
},
{
name: "信息管理站",
parent: "党委办公室",
category: "机关附属单位",
rank: "副股级"
},
{
name: "成都办事处",
parent: "党委办公室",
category: "机关附属单位",
rank: "副股级"
},
{
name: "泽普办事处",
parent: "党委办公室",
category: "机关附属单位",
rank: "副股级"
},
{
name: "信息档案站",
parent: "党委办公室",
category: "机关附属单位",
rank: "股级"
},
{
name: "信息管理站",
parent: "党委办公室",
category: "机关附属单位",
rank: "副股级"
},
{
name: "成都办事处",
parent: "党委办公室",
category: "机关附属单位",
rank: "副股级"
},
{
name: "泽普办事处",
parent: "党委办公室",
category: "机关附属单位",
rank: "副股级"
},
{
name: "市场开发科",
parent: "塔里木石油开发指挥部第二勘探公司",
category: "机关部门",
rank: "科级"
},
{
name: "生产运行科",
parent: "塔里木石油开发指挥部第二勘探公司",
category: "机关部门",
rank: "科级"
},
{
name: "人事劳资科(组织部)",
parent: "塔里木石油开发指挥部第二勘探公司",
category: "机关部门",
rank: '正处级'
},
{
name: "技能鉴定站",
parent: "人事劳资科(组织部)",
category: "机关附属单位",
rank: "副股级"
},
{
name: "培训教导队",
parent: "人事劳资科(组织部)",
category: "机关附属单位",
rank: "股级"
},
{
name: "技能鉴定站",
parent: "人事劳资科(组织部)",
category: "机关附属单位",
rank: "副股级"
},
{
name: "培训教导队",
parent: "人事劳资科(组织部)",
category: "机关附属单位",
rank: "股级"
},
{
name: "计划经营科",
parent: "塔里木石油开发指挥部第二勘探公司",
category: "机关部门",
rank: "科级"
},
{
name: "财务资产科",
parent: "塔里木石油开发指挥部第二勘探公司",
category: "机关部门",
rank: "科级"
},
{
name: "财务结算站",
parent: "财务资产科",
category: "机关附属单位",
rank: "副股级"
},
{
name: "财务结算站",
parent: "财务资产科",
category: "机关附属单位",
rank: "副股级"
},
{
name: "物资装备科",
parent: "塔里木石油开发指挥部第二勘探公司",
category: "机关部门",
rank: "科级"
},
{
name: "质量安全环保科室",
parent: "塔里木石油开发指挥部第二勘探公司",
category: "机关部门",
rank: "科级"
},
{
name: "工程技术科",
parent: "塔里木石油开发指挥部第二勘探公司",
category: "机关部门",
rank: "科级"
},
{
name: "井控管理办公室",
parent: "工程技术科",
category: "机关附属单位",
rank: "副股级"
},
{
name: "井控管理办公室",
parent: "工程技术科",
category: "机关附属单位",
rank: "副股级"
},
{
name: "纪委办公室(监察科)",
parent: "塔里木石油开发指挥部第二勘探公司",
category: "机关部门",
rank: "科级"
},
{
name: "工会、团委党群办公室",
parent: "塔里木石油开发指挥部第二勘探公司",
category: "机关部门",
rank: "科级"
},
{
name: "维护稳定办公室",
parent: "工会、团委党群办公室",
category: "机关附属单位",
rank: "股级"
},
{
name: "维护稳定办公室",
parent: "工会、团委党群办公室",
category: "机关附属单位",
rank: "股级"
},
{
name: "北疆项目部",
parent: "塔里木石油开发指挥部第二勘探公司",
category: "大队级单位",
rank: "科级"
},
{
name: "70506队",
parent: "北疆项目部",
category: "钻井队",
rank: "股级"
},
{
name: "50543队",
parent: "北疆项目部",
category: "钻井队",
rank: "股级"
},
{
name: "70526队",
parent: "北疆项目部",
category: "钻井队",
rank: "股级"
},
{
name: "70527队",
parent: "北疆项目部",
category: "钻井队",
rank: "股级"
},
{
name: "79539队",
parent: "北疆项目部",
category: "钻井队",
rank: "股级"
},
{
name: "70566队",
parent: "北疆项目部",
category: "钻井队",
rank: "股级"
},
{
name: "70583队",
parent: "北疆项目部",
category: "钻井队",
rank: "股级"
},
{
name: "70506队",
parent: "北疆项目部",
category: "钻井队",
rank: "股级"
},
{
name: "50543队",
parent: "北疆项目部",
category: "钻井队",
rank: "股级"
},
{
name: "70526队",
parent: "北疆项目部",
category: "钻井队",
rank: "股级"
},
{
name: "70527队",
parent: "北疆项目部",
category: "钻井队",
rank: "股级"
},
{
name: "79539队",
parent: "北疆项目部",
category: "钻井队",
rank: "股级"
},
{
name: "70566队",
parent: "北疆项目部",
category: "钻井队",
rank: "股级"
},
{
name: "70583队",
parent: "北疆项目部",
category: "钻井队",
rank: "股级"
},
{
name: "塔中项目部",
parent: "塔里木石油开发指挥部第二勘探公司",
category: "大队级单位",
rank: "科级"
},
{
name: "70508队",
parent: "塔中项目部",
category: "钻井队",
rank: "股级"
},
{
name: "70510队",
parent: "塔中项目部",
category: "钻井队",
rank: "股级"
},
{
name: "70523队",
parent: "塔中项目部",
category: "钻井队",
rank: "股级"
},
{
name: "70530队",
parent: "塔中项目部",
category: "钻井队",
rank: "股级"
},
{
name: "70532队",
parent: "塔中项目部",
category: "钻井队",
rank: "股级"
},
{
name: "70543队",
parent: "塔中项目部",
category: "钻井队",
rank: "股级"
},
{
name: "70545队",
parent: "塔中项目部",
category: "钻井队",
rank: "股级"
},
{
name: "70549队",
parent: "塔中项目部",
category: "钻井队",
rank: "股级"
},
{
name: "70561队",
parent: "塔中项目部",
category: "钻井队",
rank: "股级"
},
{
name: "70562队",
parent: "塔中项目部",
category: "钻井队",
rank: "股级"
},
{
name: "70584队",
parent: "塔中项目部",
category: "钻井队",
rank: "股级"
},
{
name: "70598队",
parent: "塔中项目部",
category: "钻井队",
rank: "股级"
},
{
name: "80010队",
parent: "塔中项目部",
category: "钻井队",
rank: "股级"
},
{
name: "70508队",
parent: "塔中项目部",
category: "钻井队",
rank: "股级"
},
{
name: "70510队",
parent: "塔中项目部",
category: "钻井队",
rank: "股级"
},
{
name: "70523队",
parent: "塔中项目部",
category: "钻井队",
rank: "股级"
},
{
name: "70530队",
parent: "塔中项目部",
category: "钻井队",
rank: "股级"
},
{
name: "70532队",
parent: "塔中项目部",
category: "钻井队",
rank: "股级"
},
{
name: "70543队",
parent: "塔中项目部",
category: "钻井队",
rank: "股级"
},
{
name: "70545队",
parent: "塔中项目部",
category: "钻井队",
rank: "股级"
},
{
name: "70549队",
parent: "塔中项目部",
category: "钻井队",
rank: "股级"
},
{
name: "70561队",
parent: "塔中项目部",
category: "钻井队",
rank: "股级"
},
{
name: "70562队",
parent: "塔中项目部",
category: "钻井队",
rank: "股级"
},
{
name: "70584队",
parent: "塔中项目部",
category: "钻井队",
rank: "股级"
},
{
name: "70598队",
parent: "塔中项目部",
category: "钻井队",
rank: "股级"
},
{
name: "80010队",
parent: "塔中项目部",
category: "钻井队",
rank: "股级"
},
{
name: "塔北项目部",
parent: "塔里木石油开发指挥部第二勘探公司",
category: "大队级单位",
rank: "科级"
},
{
name: "50051队",
parent: "塔北项目部",
category: "钻井队",
rank: "股级"
},
{
name: "70507队",
parent: "塔北项目部",
category: "钻井队",
rank: "股级"
},
{
name: "70509队",
parent: "塔北项目部",
category: "钻井队",
rank: "股级"
},
{
name: "70153队",
parent: "塔北项目部",
category: "钻井队",
rank: "股级"
},
{
name: "70524队",
parent: "塔北项目部",
category: "钻井队",
rank: "股级"
},
{
name: "70533队",
parent: "塔北项目部",
category: "钻井队",
rank: "股级"
},
{
name: "70537队",
parent: "塔北项目部",
category: "钻井队",
rank: "股级"
},
{
name: "70538队",
parent: "塔北项目部",
category: "钻井队",
rank: "股级"
},
{
name: "70567队",
parent: "塔北项目部",
category: "钻井队",
rank: "股级"
},
{
name: "70597队",
parent: "塔北项目部",
category: "钻井队",
rank: "股级"
},
{
name: "塔钻一对",
parent: "塔北项目部",
category: "钻井队",
rank: "股级"
},
{
name: "塔钻二队",
parent: "塔北项目部",
category: "钻井队",
rank: "股级"
},
{
name: "50051队",
parent: "塔北项目部",
category: "钻井队",
rank: "股级"
},
{
name: "70507队",
parent: "塔北项目部",
category: "钻井队",
rank: "股级"
},
{
name: "70509队",
parent: "塔北项目部",
category: "钻井队",
rank: "股级"
},
{
name: "70153队",
parent: "塔北项目部",
category: "钻井队",
rank: "股级"
},
{
name: "70524队",
parent: "塔北项目部",
category: "钻井队",
rank: "股级"
},
{
name: "70533队",
parent: "塔北项目部",
category: "钻井队",
rank: "股级"
},
{
name: "70537队",
parent: "塔北项目部",
category: "钻井队",
rank: "股级"
},
{
name: "70538队",
parent: "塔北项目部",
category: "钻井队",
rank: "股级"
},
{
name: "70567队",
parent: "塔北项目部",
category: "钻井队",
rank: "股级"
},
{
name: "70597队",
parent: "塔北项目部",
category: "钻井队",
rank: "股级"
},
{
name: "塔钻一对",
parent: "塔北项目部",
category: "钻井队",
rank: "股级"
},
{
name: "塔钻二队",
parent: "塔北项目部",
category: "钻井队",
rank: "股级"
},
{
name: "库车项目部",
parent: "塔里木石油开发指挥部第二勘探公司",
category: "大队级单位",
rank: "科级"
},
{
name: "70083队",
parent: "库车项目部",
category: "钻井队",
rank: "股级"
},
{
name: "70099队",
parent: "库车项目部",
category: "钻井队",
rank: "股级"
},
{
name: "70128队",
parent: "库车项目部",
category: "钻井队",
rank: "股级"
},
{
name: "70540队",
parent: "库车项目部",
category: "钻井队",
rank: "股级"
},
{
name: "80001队",
parent: "库车项目部",
category: "钻井队",
rank: "股级"
},
{
name: "80002队",
parent: "库车项目部",
category: "钻井队",
rank: "股级"
},
{
name: "80009队",
parent: "库车项目部",
category: "钻井队",
rank: "股级"
},
{
name: "90002队",
parent: "库车项目部",
category: "钻井队",
rank: "股级"
},
{
name: "90010队",
parent: "库车项目部",
category: "钻井队",
rank: "股级"
},
{
name: "70083队",
parent: "库车项目部",
category: "钻井队",
rank: "股级"
},
{
name: "70099队",
parent: "库车项目部",
category: "钻井队",
rank: "股级"
},
{
name: "70128队",
parent: "库车项目部",
category: "钻井队",
rank: "股级"
},
{
name: "70540队",
parent: "库车项目部",
category: "钻井队",
rank: "股级"
},
{
name: "80001队",
parent: "库车项目部",
category: "钻井队",
rank: "股级"
},
{
name: "80002队",
parent: "库车项目部",
category: "钻井队",
rank: "股级"
},
{
name: "80009队",
parent: "库车项目部",
category: "钻井队",
rank: "股级"
},
{
name: "90002队",
parent: "库车项目部",
category: "钻井队",
rank: "股级"
},
{
name: "90010队",
parent: "库车项目部",
category: "钻井队",
rank: "股级"
},
{
name: "试修作业公司",
parent: "塔里木石油开发指挥部第二勘探公司",
category: "分公司",
rank: "科级"
},
{
name: "综合管理办公室",
parent: "试修作业公司",
category: "分公司机关部门",
rank: "股级"
},
{
name: "生产协调装备管理办公室",
parent: "试修作业公司",
category: "分公司机关部门",
rank: "股级"
},
{
name: "生产技术办公室",
parent: "试修作业公司",
category: "分公司机关部门",
rank: "股级"
},
{
name: "质量安全环保部办公室",
parent: "试修作业公司",
category: "分公司机关部门",
rank: "股级"
},
{
name: "作业一对",
parent: "试修作业公司",
category: "小队",
rank: "股级"
},
{
name: "作业二队",
parent: "试修作业公司",
category: "小队",
rank: "股级"
},
{
name: "作业三队",
parent: "试修作业公司",
category: "小队",
rank: "股级"
},
{
name: "作业四队",
parent: "试修作业公司",
category: "小队",
rank: "股级"
},
{
name: "作业五队",
parent: "试修作业公司",
category: "小队",
rank: "股级"
},
{
name: "作业六队",
parent: "试修作业公司",
category: "小队",
rank: "股级"
},
{
name: "作业七对",
parent: "试修作业公司",
category: "小队",
rank: "股级"
},
{
name: "作业八队",
parent: "试修作业公司",
category: "小队",
rank: "股级"
},
{
name: "作业九队",
parent: "试修作业公司",
category: "小队",
rank: "股级"
},
{
name: "作业十队",
parent: "试修作业公司",
category: "小队",
rank: "股级"
},
{
name: "作业十一队",
parent: "试修作业公司",
category: "小队",
rank: "股级"
},
{
name: "作业十二队",
parent: "试修作业公司",
category: "小队",
rank: "股级"
},
{
name: "综合管理办公室",
parent: "试修作业公司",
category: "分公司机关部门",
rank: "股级"
},
{
name: "生产协调装备管理办公室",
parent: "试修作业公司",
category: "分公司机关部门",
rank: "股级"
},
{
name: "生产技术办公室",
parent: "试修作业公司",
category: "分公司机关部门",
rank: "股级"
},
{
name: "质量安全环保部办公室",
parent: "试修作业公司",
category: "分公司机关部门",
rank: "股级"
},
{
name: "作业一对",
parent: "试修作业公司",
category: "小队",
rank: "股级"
},
{
name: "作业二队",
parent: "试修作业公司",
category: "小队",
rank: "股级"
},
{
name: "作业三队",
parent: "试修作业公司",
category: "小队",
rank: "股级"
},
{
name: "作业四队",
parent: "试修作业公司",
category: "小队",
rank: "股级"
},
{
name: "作业五队",
parent: "试修作业公司",
category: "小队",
rank: "股级"
},
{
name: "作业六队",
parent: "试修作业公司",
category: "小队",
rank: "股级"
},
{
name: "作业七对",
parent: "试修作业公司",
category: "小队",
rank: "股级"
},
{
name: "作业八队",
parent: "试修作业公司",
category: "小队",
rank: "股级"
},
{
name: "作业九队",
parent: "试修作业公司",
category: "小队",
rank: "股级"
},
{
name: "作业十队",
parent: "试修作业公司",
category: "小队",
rank: "股级"
},
{
name: "作业十一队",
parent: "试修作业公司",
category: "小队",
rank: "股级"
},
{
name: "作业十二队",
parent: "试修作业公司",
category: "小队",
rank: "股级"
},
{
name: "钻具井控技术服务公司",
parent: "塔里木石油开发指挥部第二勘探公司",
category: "分公司",
rank: "科级"
},
{
name: "井控综合办公室",
parent: "钻具井控技术服务公司",
category: "分公司机关部门",
rank: "股级"
},
{
name: "生产技术安全办公室",
parent: "钻具井控技术服务公司",
category: "分公司机关部门",
rank: "股级"
},
{
name: "井控维修队",
parent: "钻具井控技术服务公司",
category: "小队",
rank: "股级"
},
{
name: "现场服务队",
parent: "钻具井控技术服务公司",
category: "小队",
rank: "股级"
},
{
name: "北疆井控服务队",
parent: "钻具井控技术服务公司",
category: "小队",
rank: "股级"
},
{
name: "井控综合办公室",
parent: "钻具井控技术服务公司",
category: "分公司机关部门",
rank: "股级"
},
{
name: "生产技术安全办公室",
parent: "钻具井控技术服务公司",
category: "分公司机关部门",
rank: "股级"
},
{
name: "井控维修队",
parent: "钻具井控技术服务公司",
category: "小队",
rank: "股级"
},
{
name: "现场服务队",
parent: "钻具井控技术服务公司",
category: "小队",
rank: "股级"
},
{
name: "北疆井控服务队",
parent: "钻具井控技术服务公司",
category: "小队",
rank: "股级"
},
{
name: "工程技术服务公司",
parent: "塔里木石油开发指挥部第二勘探公司",
category: "分公司",
rank: "科级"
},
{
name: "轮南钻井液检测实验室",
parent: "工程技术服务公司",
category: "小队",
rank: "股级"
},
{
name: "轮南钻井液检测实验室",
parent: "工程技术服务公司",
category: "小队",
rank: "股级"
},
{
name: "物资供应站",
parent: "塔里木石油开发指挥部第二勘探公司",
category: "分公司",
rank: "科级"
},
{
name: "轮南库房",
parent: "物资供应站",
category: "小队",
rank: "股级"
},
{
name: "大二线库区",
parent: "物资供应站",
category: "小队",
rank: "股级"
},
{
name: "轮南库房",
parent: "物资供应站",
category: "小队",
rank: "股级"
},
{
name: "大二线库区",
parent: "物资供应站",
category: "小队",
rank: "股级"
},
{
name: "生产生活服务公司",
parent: "塔里木石油开发指挥部第二勘探公司",
category: "分公司",
rank: "科级"
},
{
name: "轮南基地管理办公室",
parent: "生产生活服务公司",
category: "小队",
rank: "股级"
},
{
name: "生产指挥车队",
parent: "生产生活服务公司",
category: "小队",
rank: "股级"
},
{
name: "生活服务队",
parent: "生产生活服务公司",
category: "小队",
rank: "股级"
},
{
name: "轮南基地管理办公室",
parent: "生产生活服务公司",
category: "小队",
rank: "股级"
},
{
name: "生产指挥车队",
parent: "生产生活服务公司",
category: "小队",
rank: "股级"
},
{
name: "生活服务队",
parent: "生产生活服务公司",
category: "小队",
rank: "股级"
},
{
name: "库尔勒川塔石油钻采有限公司",
parent: "塔里木石油开发指挥部第二勘探公司",
category: "分公司",
rank: "科级"
},
{
name: "综合办公室",
parent: "库尔勒川塔石油钻采有限公司",
category: "分公司机关部门",
rank: "股级"
},
{
name: "安全技术生产办公室",
parent: "库尔勒川塔石油钻采有限公司",
category: "分公司机关部门",
rank: "股级"
},
{
name: "经营财务办公室",
parent: "库尔勒川塔石油钻采有限公司",
category: "分公司机关部门",
rank: "股级"
},
{
name: "市场经营办公室",
parent: "库尔勒川塔石油钻采有限公司",
category: "分公司机关部门",
rank: "股级"
},
{
name: "生产服务车队",
parent: "库尔勒川塔石油钻采有限公司",
category: "小队",
rank: "股级"
},
{
name: "生产现场服务队",
parent: "库尔勒川塔石油钻采有限公司",
category: "小队",
rank: "股级"
},
{
name: "综合办公室",
parent: "库尔勒川塔石油钻采有限公司",
category: "分公司机关部门",
rank: "股级"
},
{
name: "安全技术生产办公室",
parent: "库尔勒川塔石油钻采有限公司",
category: "分公司机关部门",
rank: "股级"
},
{
name: "经营财务办公室",
parent: "库尔勒川塔石油钻采有限公司",
category: "分公司机关部门",
rank: "股级"
},
{
name: "市场经营办公室",
parent: "库尔勒川塔石油钻采有限公司",
category: "分公司机关部门",
rank: "股级"
},
{
name: "生产服务车队",
parent: "库尔勒川塔石油钻采有限公司",
category: "小队",
rank: "股级"
},
{
name: "生产现场服务队",
parent: "库尔勒川塔石油钻采有限公司",
category: "小队",
rank: "股级"
},
{
name: "川塔公司",
parent: "塔里木石油开发指挥部第二勘探公司",
category: "分公司",
rank: "科级"
},
{
name: "塔中400万吨产能建设项目部",
parent: "塔里木石油开发指挥部第二勘探公司",
category: "机关部门",
rank: "正处级"
},
{
name: "井下分公司",
parent: "塔里木石油开发指挥部第二勘探公司",
category: "分公司",
rank: "科级"
},
{
name: "测井分公司",
parent: "塔里木石油开发指挥部第二勘探公司",
category: "分公司",
rank: "科级"
},
{
name: "钻采分公司",
parent: "塔里木石油开发指挥部第二勘探公司",
category: "分公司",
rank: "科级"
},
{
name: "录井分公司",
parent: "塔里木石油开发指挥部第二勘探公司",
category: "分公司",
rank: "科级"
},
{
name: "蜀渝分公司",
parent: "塔里木石油开发指挥部第二勘探公司",
category: "分公司",
rank: "科级"
}
]

company = AddOrganization.run(name: "塔里木石油开发指挥部第二勘探公司", rank: "处级", category: "公司", parent_id: nil).result

def init_organ organ
  if parent = Organization.find_by_name(organ[:parent])
    AddOrganization.run(name: organ[:name], rank: organ[:rank], category: organ[:category], parent_id: parent.id)
  else
    if (organ = @init_organs.select { |e| e[:name] == organ[:parent] }.first)
      init_organ organ
    end
  end
end

@init_organs.each do |organ|
  init_organ organ
end
